<!DOCTYPE html>
<html>
<head>
    <th:block th:include="include :: headermain('互助保障系统V3')"/>
    <title>业务办理-入会业务</title>
    <script src="/plugin/jquery/jquery.min.js"></script>
    <script src="/plugin/jquery/jquery.plugin.js"></script>
    <script src="/plugin/vue/vue.min.js"></script>
    <script src="/plugin/layui/layui.all.js"></script>
    <script src="/unit/resource/js/script.js"></script>
</head>
<body>
<div class="page">
    <!-- 头部信息 -->
    <th:block th:include="include :: top"/>
    <div class="center">
        <div class="page-content page-wrap">
            <!-- 左侧导航 -->
            <th:block th:include="include :: left"/>
            <div class="page-wrap-container">

                <div class="page-account">
                    <div class="page-tab">
                        <a href="/hzpolicy/hzPolicyFront/policySituation">参互情况</a>
                        <a class="on" href="/hzpolicy/hzPolicyFront/policyApply">业务办理</a>
                        <a href="/hzpolicy/hzPolicyFront/policyPerson">职工入会</a>
                    </div>

                    <!-- 业务办理列表 -->
                    <div class="page-tab-content" style="display: block;padding-top:30px;">
                        <div class="page-step">
                            <span class="complete">选择计划</span>
                            <i class="fa fa-arrow-circle-right complete"></i>
                            <span class="current">填写资料</span>
                            <i class="fa fa-arrow-circle-right "></i>
                            <span>提交审核</span>
                        </div>

                        <form class="page-form">
                            <input type="hidden" name="id" value="${policyInfo.id}" />
                            <div class="page-form-item">
                                <div class="page-form-label">已选择计划：</div>
                                <div class="page-form-input">
                                    <table class="page-table page-table-list policy-insurance" style=" min-width:400px ">
                                        <tr>
                                            <th>活动名称</th>
                                            <th>参加标准</th>
                                            <th>参加份数</th>
                                            <th>参加人数</th>
                                            <th>新入会人数</th>
                                            <th>重新入会人数</th>
                                            <th>续互人数</th>
                                            <th>退休续互人数</th>
                                            <th>总金额</th>
                                        </tr>
                                        <c:forEach items="${policyInsurances}" var="policyInsurance">
                                            <tr>
                                                <td>${policyInsurance.insurancename}</td>
                                                <td>${policyInsurance.price} /人/份</td>
                                                <td>${policyInsurance.unitqty}份</td>
                                                <td>${policyInsurance.totalperson}人</td>
                                                <td>${policyInsurance.newPersonNum}人</td>
                                                <td>${policyInsurance.renewPersonNum}人</td>
                                                <td>${policyInsurance.renewalPersonNum}人</td>
                                                <td>${policyInsurance.retirePersonNum}人</td>
                                                <td>${policyInsurance.totalamount}</td>
                                            </tr>
                                        </c:forEach>
                                    </table>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">单位名称：</div>
                                <div class="page-form-input">
                                    <div class="page-form-text">${policyInfo.unitname}</div>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">所属机构：</div>
                                <div class="page-form-input">
                                    <div class="page-form-text">${policyInfo.organizename}</div>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">所属区域：</div>
                                <div class="page-form-input">
                                    <div class="page-form-text">${policyInfo.regionname}</div>
                                </div>
                            </div>
                            <p style="margin-bottom:20px; color:red">如单位资料信息有误，请在单位账户修改后再提交入会申请。</p>

                            <div class="page-form-item">
                                <div class="page-form-label">联系人：</div>
                                <div class="page-form-input">
                                    <input type="text" style="width:120px" name="contact" value="${policyInfo.contact}" />
                                    <span style="color:red">*</span>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">联系手机：</div>
                                <div class="page-form-input">
                                    <input type="text" style="width:120px" name="mobile" value="${policyInfo.mobile}" />
                                    <span style="color:red">*</span>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">联系邮箱：</div>
                                <div class="page-form-input">
                                    <input type="text" style="width:210px" name="email" value="${policyInfo.email}" />
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">联系电话：</div>
                                <div class="page-form-input">
                                    <input type="text" style="width:120px" name="phone" value="${policyInfo.phone}" />
                                </div>
                            </div>
                            <p style="margin-bottom:20px; color:red">联系手机和联系邮箱用于接收系统发送的业务进度通知，请填写能够正常接收信息的号码。</p>
                            <div class="page-form-item">
                                <div class="page-form-label">缴纳医保人数：</div>
                                <div class="page-form-input">
                                    <input type="text" style="width:120px" name="totalworker" value="${policyInfo.totalworker}" />
                                    <span style="color:red">*</span>
                                </div>
                            </div>
                            <p style="margin-bottom:20px; color:red">缴纳医保人数为：单位参加城镇职工医保的人数。</p>
                            <div class="page-form-item">
                                <div class="page-form-label">单位付款名称：</div>
                                <div class="page-form-input">
                                    <input type="text" style="width:300px" name="paymentname" value="${policyInfo.paymentname}" />
                                    <span style="color:red">*</span>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">单位付款账号：</div>
                                <div class="page-form-input">
                                    <input type="text" style="width:200px" id="bankcard" name="bankcard" value="${policyInfo.bankcard}" />
                                    <span style="color:red">*</span>
                                </div>
                            </div>

                            <div class="page-form-item">
                                <div class="page-form-label">工会经费/人：</div>
                                <div class="page-form-input">
                                    <c:if test="${empty policyInfo.unionFunds}">
                                        <input type="text" style="width:100px" name="unionFunds" value="0" onfocus="if (value =='0'){value =''}" onblur="if (value ==''){value='0'}" />
                                    </c:if>
                                    <c:if test="${not empty policyInfo.unionFunds}">
                                        <input type="text" style="width:100px" name="unionFunds" value="${policyInfo.unionFunds}" />
                                    </c:if>
                                    <span style="color:red">*</span>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">单位补助/人：</div>
                                <div class="page-form-input">
                                    <c:if test="${empty policyInfo.unitSubsidy}">
                                        <input type="text" style="width:100px" name="unitSubsidy" value="0" onfocus="if (value =='0'){value =''}" onblur="if (value ==''){value='0'}" />
                                    </c:if>
                                    <c:if test="${not empty policyInfo.unitSubsidy}">
                                        <input type="text" style="width:100px" name="unitSubsidy" value="${policyInfo.unitSubsidy}" />
                                    </c:if>
                                    <span style="color:red">*</span>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label">会员自付/人：</div>
                                <div class="page-form-input">
                                    <c:if test="${empty policyInfo.personCost}">
                                        <input type="text" style="width:100px" name="personCost" value="0" onfocus="if (value =='0'){value =''}" onblur="if (value ==''){value='0'}" />
                                    </c:if>
                                    <c:if test="${not empty policyInfo.personCost}">
                                        <input type="text" style="width:100px" name="personCost" value="${policyInfo.personCost}" />
                                    </c:if>
                                    <span style="color:red">*</span>
                                </div>
                            </div>
                            <p style="margin-bottom:20px; color:red">工会经费/人、单位补助/人、会员自付/人之和需为90元整</p>

                            <div class="page-form-item">
                                <div class="page-form-label">特别备注：</div>
                                <div class="page-form-input">
                                    <textarea name="remarks">${policyInfo.remarks}</textarea>
                                    <div class="page-form-placeholder">向所属机构特别说明的内容</div>
                                </div>
                            </div>
                            <div class="page-form-item">
                                <div class="page-form-label"></div>
                                <div class="page-form-input">
                                    <a class="layui-btn sub_policy_examine">提交到所属机构审核</a>
                                    <a class="layui-btn layui-btn-primary" href="/hzpolicy/hzPolicyFront/launchPolicyApply?id=${policyInfo.id}">重新选择计划</a>
                                </div>
                            </div>
                        </form>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <!-- 底部信息 -->
    <th:block th:include="include :: footer"/>
</div>

<script type="text/javascript">

    /* 输入银行卡号后调用方法,鼠标离开输入框 */
    $("#bankcard").change(function() {
        var bankCard = $(this).val();
        if(bankCard != null && bankCard != ""){
            getBankNames(bankCard);
        }
    });

    /* 查询银行信息方法 */
    function getBankNames(bankCard){
        var idx = layer.load(0);
        $.soon.ajax({
            url: "/hzclaim/hzClaimFront/getBankNo?bankCard=" + bankCard,
            success: function (data) {
                if(data.success){
                    layer.close(idx);
                }else {
                    layer.close(idx);
                    // 银行卡号检验不通过
                    layer.prompt({
                        formType: 0,
                        closeBtn: 0, // 关闭按钮样式
                        value: '',
                        area:['450px', 'auto'],
                        title: '请再次确认银行卡号。',
                        btn: ['确定','取消'], //按钮，
                        btn2: function(index, elem){
                            $('#bankcard').val("");
                        },
                        btnAlign: 'c'
                    }, function (value,index) {
                        if(value != bankCard){
                            layer.msg('两次输入卡号不一致', {time:2000})
                        }if(value == bankCard){
                            layer.close(index);
                        }
                    });
                }
            }
        });
    }

    // 提交到所属机构审核
    $(".sub_policy_examine").click(function () {
        var idx = layer.load(0);
        $.soon.ajax({
            url: "/hzpolicy/hzPolicyFront/subPolicyToExamine",
            method : 'Post',
            data : $(".page-form").serialize(),
            success: function (res) {
                layer.close(idx);
                if(res.success){
                    layer.msg(res.msg);
                    setTimeout(function () {
                        // window.location.href = "/hzpolicy/hzPolicyFront/policyApplyDetails?id=${policyInfo.id}";
                        window.location.href = "/hzpolicy/hzPolicyFront/policyPaymentProof?id=${policyInfo.id}";
                    }, 1000);
                }else{
                    layer.msg(res.msg);
                }
            },
            error: function(res){
                layer.msg("提交失败");
            }
        });
    });
</script>

</body>
</html>
